import request from '@/utils/request';
import { stringify } from 'qs';
import { toFormData } from '@/utils/utils.jsx';

export async function query() {
  return request('/api/userList');
}

//获取用户信息
export async function getMessage(params) {
  return request(`/zjf-oms/user/detail?${stringify(params)}`);
}

//获取当前登录用户信息
export async function getUserDetailOp() {
  return request(`/blade-user/user/getUserDetail`);
}

//修改登录密码
export async function changePassword(params) {
  return request(`/blade-user/updatepwd`, {
    method: 'Post',
    data: params,
  });
}

//修改支付密码
export async function changePayPassword(params) {
  return request(`/blade-user/setPaymentPassword`, {
    method: 'Post',
    data: params,
  });
}

//修改商户支付密码
export async function changeSellerPayPassword(params) {
  return request(`/blade-user/user/updateMerchantPassword`, {
    method: 'Post',
    data: params,
  });
}

//验证验证码
export async function verificationCode(params) {
  return request(`/blade-user/phone/verifyCode?${stringify(params)}`);
}

//修改手机号码
export async function changePhone(params) {
  return request(`/blade-user/user/updateMobile`, {
    method: 'Post',
    data: params,
  });
}

//大用户补充资料
export async function submitAddDataOp(params) {
  return request(`/zjf-pays/panAddData/submitAddData`, {
    method: 'Post',
    data: params,
  });
}

/* //获取认证信息详情
export async function rzDetails(params) {
  return request(
    `/blade-user/alipaycertificationextend/detail?${stringify(params)}`
  );
} */

//获取个人认证信息详情
// export async function personalCertificationDetails(params) {
//   return request(`/blade-user/alipaycertification/detail?${stringify(params)}`);
// }

// //获取企业认证信息详情
// export async function enterpriseCertificationDetails(params) {
//   return request(
//     `/blade-user/alipaycertificationextend/detail?${stringify(params)}`
//   );
// }

// 开户行下拉
export async function bankSearch(params) {
  return request(`/blade-user/banklist/like?${stringify(params)}`);
}

// 获取银行卡验证码
export async function bankCode(params) {
  return request(`/blade-user/bankCard/bankCardSendCode`, {
    method: 'Post',
    data: params,
  });
}

// 绑定银行卡接口
export async function bankCard(params) {
  return request(`/blade-user/bankCard/backfillVerificationCode`, {
    method: 'Post',
    data: params,
  });
}

// 获取银行卡信息
export async function getBankCard(params) {
  return request(`/blade-user/bankCard/bankDetails?${stringify(params)}`);
}

// 解除银行卡
export async function relieveCard(params) {
  return request(`/blade-user/bankCard/untieBank?${stringify(params)}`);
}

// 开通电子账户
export async function openingAccount(params) {
  return request(`/blade-user/pan/openAccount?${stringify(params)}`);
}

// 确认打款
export async function payment(params) {
  return request(`/blade-user/bankCard/confirmPayment`, {
    method: 'Post',
    data: params,
  });
}

// 小额打款绑定银行卡
export async function paymentBinding(params) {
  return request(`/blade-user/bankCard/checkAmount`, {
    method: 'Post',
    data: params,
  });
}

//提交身份证信息
export async function submitCardOp(params) {
    return request(`/zjf-pays/openAccount/submitCard`, {
      method: 'Post',
      body: toFormData(params)
    });
  }

//获取认证信息
export async function getAttestation(params) {
    return request(`/zjf-pays/openAccount/getAttestationJM?${stringify(params)}`);
  }
  
//账户管理详情
export async function getAccountDetail(params) {
    return request(`/zjf-pays/openAccount/accountDetail`);
  }

//绑定银行卡列表返回
export async function getBankListDetails(params) {
    return request(`/zjf-pays/openAccountV3/getBankListDetails?${stringify(params)}`);
  }

//查询绑定状态 0：未绑定 1：部分绑定 2：已绑定
export async function getBankBindState(params) {
    return request(`/blade-user/bankCard/getBankBindState?${stringify(params)}`);
  }

//查询平安账户状态和绑卡信息
export async function queryPingAnAccount(params) {
    return request(`/zjf-pays/openAccountV3/queryPingAnAccount?${stringify(params)}`);
  }

//线下绑卡，不与银行产生交互
export async function personalBindCardOp(params) {
  return request(`/blade-user/bankCard/offlineBindBankCard`, {
    method: 'Post',
    data: params
  });
}

//线下解除绑卡，不与银行产生交互
export async function personalRelieveCardOp(params) {
  return request(`/blade-user/bankCard/offlineUnBindBank`, {
    method: 'Post',
    body: toFormData(params)
  });
}

//根据手机号绑定、解除微信unionid
export async function bindingUnbindingVxOp(params) {
  return request(`/blade-user/user/bindingMobileUnionId`, {
    method: 'POST',
    body: toFormData(params),
  })
}

//获取微信二维码参数
export async function getWxLoginParamsOp(params) {
  return request(`/blade-user/wx/web/findAppKey?${stringify(params)}`);
}